]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
modalDialog: grab focus immediately, not after fade-in
authorDan Winship <danw@gnome.org>
Tue, 15 Mar 2011 20:05:40 +0000 (16:05 -0400)
committerDan Winship <danw@gnome.org>
Mon, 21 Mar 2011 18:26:08 +0000 (14:26 -0400)
If the user types Alt+F2 and then immediately starts typing, some keys
can get lost. Fix that by grabbing focus sooner.

https://bugzilla.gnome.org/show_bug.cgi?id=644857

js/ui/modalDialog.js
js/ui/runDialog.js

index 45a1e3c38b36878799649a129c9dedf9bb83c4da..56bc1a2033108770f2a03d5540acdda340819be7 100644 (file)
@@ -148,19 +148,23 @@ ModalDialog.prototype = {
         this._lightbox.show();
         this._group.opacity = 0;
         this._group.show();
+        this._initialKeyFocus.grab_key_focus();
         Tweener.addTween(this._group,
                          { opacity: 255,
                            time: OPEN_AND_CLOSE_TIME,
                            transition: 'easeOutQuad',
                            onComplete: Lang.bind(this,
                                function() {
-                                   this._initialKeyFocus.grab_key_focus();
                                    this.state = State.OPENED;
                                    this.emit('opened');
-                               }),
+                               })
                          });
     },
 
+    setInitialKeyFocus: function(actor) {
+        this._initialKeyFocus = actor;
+    },
+
     open: function(timestamp) {
         if (this.state == State.OPENED || this.state == State.OPENING)
             return true;
@@ -168,8 +172,6 @@ ModalDialog.prototype = {
         if (!Main.pushModal(this._group, timestamp))
             return false;
 
-        global.stage.set_key_focus(this._group);
-
         this._fadeOpen();
         return true;
     },
index 2a02a3b022faaff20c5165385c5c165fb5d1f667..427979722dc3f2aff5bfa3e816cc5861da399453 100644 (file)
@@ -210,10 +210,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
 
         this._entryText = entry.clutter_text;
         this.contentLayout.add(entry, { y_align: St.Align.START });
-        this.connect('opened',
-                     Lang.bind(this, function() {
-                         this._entryText.grab_key_focus();
-                     }));
+        this.setInitialKeyFocus(this._entryText);
 
         this._errorBox = new St.BoxLayout({ style_class: 'run-dialog-error-box' });